package org.hako.recite.word.tool;

/**
 * The pair of kannji and yomi. Kannji is a single character, and yomi may be
 * contain more than one character.
 * 
 * @since 0.4.14
 * @author <a href="mailto:xnnyygn@gmail.com">xnnyygn</a>
 */
public class KannjiYomiPair {

	private String kannji;
	private String yomi;
	private boolean isYonn = false;

	/**
	 * Create
	 * 
	 * @param kannji
	 * @param yomi
	 */
	public KannjiYomiPair(String kannji, String yomi) {
		super();
		this.kannji = kannji;
		this.yomi = yomi;
	}

	/**
	 * Get kannji.
	 * 
	 * @return the kannji
	 */
	public String getKannji() {
		return kannji;
	}

	/**
	 * Get yomi.
	 * 
	 * @return the yomi
	 */
	public String getYomi() {
		return yomi;
	}

	/**
	 * Get isYonn.
	 * 
	 * @return the isYonn
	 */
	public boolean isYonn() {
		return isYonn;
	}

	/**
	 * Set isYonn.
	 * 
	 * @param isYonn
	 *            the isYonn to set
	 */
	public void setYonn(boolean isYonn) {
		this.isYonn = isYonn;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((kannji == null) ? 0 : kannji.hashCode());
		result = prime * result + ((yomi == null) ? 0 : yomi.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		KannjiYomiPair other = (KannjiYomiPair) obj;
		if (kannji == null) {
			if (other.kannji != null)
				return false;
		} else if (!kannji.equals(other.kannji))
			return false;
		if (yomi == null) {
			if (other.yomi != null)
				return false;
		} else if (!yomi.equals(other.yomi))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "KannjiYomiPair [kannji=" + kannji + ", yomi=" + yomi + "]";
	}

}
